Calendar All Tests
Current file: /home/estudydev/workspace/eStudy_svn/web/calendar/classes/export/icalendar/class.icalendarevent.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 6 / 6
100.00 %100.00%
100.00% 24 / 24
 
iCalendarEvent
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 6 / 6
100.00 %100.00%
100.00% 24 / 24
 public function __construct($data)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 8 / 8
 public function formattedString()
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 9 / 9
 private function description($data)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 1 / 1
 private function isFacultative($data)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 1 / 1
 private function isWholeDay($data)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 1 / 1
 private function formatDate($date)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 4 / 4


       1                 : <?php                                                                                                                 
       2                 : class iCalendarEvent {                                                                                                
       3                 :                                                                                                                       
       4                 :     private $start;                                                                                                   
       5                 :     private $end;                                                                                                     
       6                 :     private $summary;                                                                                                 
       7                 :     private $description;                                                                                             
       8                 :     private $mailto;                                                                                                  
       9                 :     private $facultative;                                                                                             
      10                 :     private $wholeDay;                                                                                                
      11                 :                                                                                                                       
      12                 :     // $start, $end, $summery, $description=null, $organizer=null                                                     
      13                 :                                                                                                                       
      14                 :     public function __construct( $data ) {                                                                            
      15               7 :         $this->wholeDay = $this->isWholeDay( $data );                                                                 
      16               7 :         $this->start    = $this->formatDate($data['start']);                                                          
      17               7 :         $this->end        = (isset($data['end'])) ? $this->formatDate($data['end']) : null;                           
      18               7 :         $this->facultative  = $this->isFacultative($data);                                                            
      19               7 :         $this->summary    = $data['summary'];                                                                         
      20               7 :         $this->description = $this->description($data);                                                               
      21               7 :         $this->mailto   = (isset($data['mailto'])) ? $data['mailto'] : null;                                          
      22               7 :     }                                                                                                                 
      23                 :                                                                                                                       
      24                 :     public function formattedString() {                                                                               
      25               7 :         $str = "BEGIN:VEVENT\n";                                                                                      
      26               7 :         $str .= ($this->mailto) ? "MAILTO:$this->mailto\n" : "";                                                      
      27               7 :         $str .= "SUMMARY:$this->summary";                                                                             
      28               7 :         $str .= $this->facultative ? " (F)\n" : "\n";                                                                 
      29               7 :         $str .= "DESCRIPTION:" . substr($this->description,0,100)."\n";                                               
      30               7 :         $str .= "DTSTART:$this->start\n";                                                                             
      31               7 :         $str .= ($this->end) ? "DTEND:$this->end\n" : "";                                                             
      32               7 :         $str .= "END:VEVENT\n";                                                                                       
      33                 :                                                                                                                       
      34               7 :         return $str;                                                                                                  
      35                 :     }                                                                                                                 
      36                 :                                                                                                                       
      37                 :     private function description( $data ) {                                                                           
      38               7 :         return $this->isFacultative( $data ) ? "(Fakultativer Termin) " . $data['description'] : $data['description'];
      39                 :     }                                                                                                                 
      40                 :                                                                                                                       
      41                 :     private function isFacultative( $data ) {                                                                         
      42               7 :         return (isset($data['facultative']) && $data['facultative'] == true) ? true : false;                          
      43                 :     }                                                                                                                 
      44                 :                                                                                                                       
      45                 :     private function isWholeDay( $data ) {                                                                            
      46               7 :         return (isset($data['wholeday']) && $data['wholeday'] == true);                                               
      47                 :     }                                                                                                                 
      48                 :                                                                                                                       
      49                 :     private function formatDate( $date ) {                                                                            
      50               7 :         $str = date("Ymd",strtotime($date));                                                                          
      51                 :                                                                                                                       
      52               7 :         if ($this->wholeDay == true) return $str;                                                                     
      53                 :                                                                                                                       
      54                 :         $str .= "T"                                                                                                   
      55               6 :              . date("His",strtotime($date));                                                                          
      56                 :                                                                                                                       
      57               6 :         return $str;                                                                                                  
      58                 :     }                                                                                                                 

Generated by PHPUnit 3.2.21 and Xdebug 2.0.3 at Thu Nov 26 17:01:15 CET 2009.